<style>
    div{color: red;font-style: italic;}
</style>
<div>HTML+CSS系列教程</div>


<script>
    let div = document.querySelector('div');
    let timer = null;
    let flag = true;
    div.onmouseover = function(){
        timer = setInterval(()=>{
        if(flag){
            div.style.color = 'blue';
            div.style.fontStyle = 'normal';
        }
        else{
            div.style.color = 'red';
            div.style.fontStyle = 'italic';
        }
        flag = !flag;
    },500);
    };

    div.onmouseout = function(){
        clearInterval(timer);
    }
</script>